//
//  UseEnumerate.swift
//  swiftStudy
//
//  Created by unisedu on 16/4/1.
//  Copyright © 2016年 CaoFei. All rights reserved.
//

import UIKit
/**
 枚举数组元素的方法
 */
class UseEnumerate: NSObject {

    
    func show(){
        let array = ["asdf","fff","dd","cc"]
        let str = array[0]
        debugPrint(str)
//        var i = 0
        //等价
        //for i in 0...(array.count-1)
        //for i in 0...array.count
        //{
        //    print("{" + array[i] + "}")
        //}
        //print("")
        
        
        for value in array
        {
            print("<" + value + ">")
        }
        
        //for (index ,value) in enumerate(array)
        //{
        //    print("索引:\(index) 书组元素\(value)")
        //}
        for (index, value) in array.enumerate() {
            // do something with (index + 5) and/or value
            print("索引:\(index) 书组元素\(value)")
        }
    }
}
